package net.hn.hnms.sys.common.core.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;

/**
 * jackson 配置
 *
 * @author Lion Li
 */
@Slf4j
@AutoConfigureBefore(JacksonAutoConfiguration.class)
public class JacksonConfig {

//    @Bean
//    public Jackson2ObjectMapperBuilderCustomizer customizer() {
//        return builder -> {
//            // 全局配置序列化返回 JSON 处理
//            JavaTimeModule javaTimeModule = new JavaTimeModule();
//            javaTimeModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE);
//            javaTimeModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE);
//            javaTimeModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE);
//            javaTimeModule.addSerializer(BigDecimal.class, ToStringSerializer.instance);
//            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//            javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter));
//            javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter));
//            builder.modules(javaTimeModule);
//            builder.timeZone(TimeZone.getDefault());
//            log.info("初始化 jackson 配置");
//        };
//    }

}
